import requests

url = 'https://m.ctrip.com/restapi/soa2/14666/json/GetBookingByStationV3'
data = {"DepartStation": "广州", "ArriveStation": "郑州", "DepartDate": "2021-11-6", "ChannelName": "ctrip.wx",
        "head": {"cid": "09031103219143440763", "ctok": "", "cver": "2.25.0", "lang": "01", "sid": "", "syscode": "30",
                 "auth": "5BF420C9594EE0C89395121E8CE0B36F05D031EB7886838E6ED7CDFB79259875", "sauth": "",
                 "extension": [{"name": "xtrainwxplatform", "value": "windows"},
                               {"name": "xtrainwxversion", "value": "20191226.01"},
                               {"name": "xtrainminiappchannel", "value": "Train.Train"},
                               {"name": "xtrainclientInfo", "value": "windows | microsoft | "},
                               {"name": "xtrainwxcityname", "value": ""}, {"name": "xtrainwxlatitude", "value": "0"},
                               {"name": "xtrainwxlongitude", "value": "0"},
                               {"name": "appId", "value": "wxd18d0e7f7784a6c4"}, {"name": "scene", "value": "1001"}]
                 }
        }
headers = {
    "Host": "m.ctrip.com",
    "Connection": "keep-alive",

    "Cookie": "Union=OUID=&AllianceID=263290&SID=712652&SourceID=55552712;DUID=u=79DC3F61FC10657FBC5CC84D2AD46CDE9E0DF232FE448CE287F005D03FF525BF&v=0;",
    "User-Agent": "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/53.0.2785.143 Safari/537.36 MicroMessenger/7.0.9.501 NetType/WIFI MiniProgramEnv/Windows WindowsWechat",
    # "content-type": "application/json",
    # "x-ctx-currency": "CNY",
    # "x-ctx-group": "ctrip",
    # "x-ctx-locale": "zh-CN",
    # "x-ctx-region": "CN",
    "x-wx-openid": "9800340d-3367-40f7-82e9-fdf7fdfa379c",
    "Referer": "https://servicewechat.com/wxd18d0e7f7784a6c4/68/page-frame.html"
    # "Accept-Encoding": "gzip, deflate, br",
}

res = requests.post(url, headers=headers, json=data, verify=False).json()
# print(res)
for i in res["ResponseBody"]["TrainInfoList"]:
    print(i["TrainNumber"])#列车编号
